.text
.data
.globl static_store
.type static_store, @object
static_store:
    .long 30

.section .rodata
.LC0:
    .string "String Literal"

.section .data.rel.local,"aw"
.globl pcg
pcg:
    .quad .LC0

.align 8
.section .rodata
.LC1:
	.string	"static_store: %d at %p\n"
.LC2:
	.string	" auto_store: %d at %p\n"
.LC3:
	.string	" *pi: %d at %p\n"
.LC4:
	.string	" %s at %p\n"
.LC5:
	.string	"Quoted String"

.LC6:
    .string "Dynamic String"

.text
.globl main
.type main, @function
main:
    pushq %rbp
    movq %rsp, %rbp

    subq $48, %rsp
    // auto_store:-4(%rbp)
    // auto_string:-20(%rbp)
    // pi: -28(%rbp)
    // pcl: -36(%rbp)
    movl $40, -4(%rbp) /* auto_store */

    movb $'A', -20(%rbp)
    movb $'u', -19(%rbp)
    movb $'t', -18(%rbp)
    movb $'o', -17(%rbp)
    movb $' ', -16(%rbp)
    movb $'c', -15(%rbp)
    movb $'h', -14(%rbp)
    movb $'a', -13(%rbp)
    movb $'r', -12(%rbp)
    movb $' ', -11(%rbp)
    movb $'A', -10(%rbp)
    movb $'r', -9(%rbp)
    movb $'r', -8(%rbp)
    movb $'a', -7(%rbp)
    movb $'y', -6(%rbp)
    movb $0, -5(%rbp)

    // sizeof(int)
    movq $4, %rdi
    call malloc
    movq %rax, -28(%rbp) /* pi */
    movl $35, (%rax)

    movq $15, %rdi
    call malloc
    movq %rax, -36(%rbp) /* pcl */
    movq %rax, %rdi
    leaq .LC6(%rip), %rsi
    call strcpy

    movl static_store(%rip), %esi
    leaq static_store(%rip), %rdx
    leaq .LC1(%rip), %rdi
    movl $0, %eax
    call printf

    movl -4(%rbp) /* auto_store */, %esi
    leaq -4(%rbp) /* auto_store */, %rdx
    leaq .LC2(%rip), %rdi
    movl $0, %eax
    call printf

    movq -28(%rbp) /* pi */, %rdx
    movl (%rdx), %esi
    leaq .LC3(%rip), %rdi
    movl $0, %eax
    call printf

    movq pcg(%rip), %rsi
    movq %rsi, %rdx
    leaq .LC4(%rip), %rdi
    movl $0, %eax
    call printf

    leaq -20(%rbp) /* auto_string */, %rsi
    movq %rsi, %rdx
    leaq .LC4(%rip), %rdi
    movl $0, %eax
    call printf

    movq -36(%rbp) /* pcl */, %rsi
    movq %rsi, %rdx
    leaq .LC4(%rip), %rdi
    movl $0, %eax
    call printf

    leaq .LC5(%rip), %rsi
    movq %rsi, %rdx
    leaq .LC4(%rip), %rdi
    movl $0, %eax
    call printf

    movq -28(%rbp) /* pi */, %rdi
    call free

    movq -36(%rbp) /* pcl */, %rdi
    call free

    movl $0, %eax
    leave
    ret